<template>
  <section>
    <el-card class="box-card">
      <el-row style="margin-top: 20px;">
        <el-col :span="12">
          <el-form
            label-width="100px">
            <el-form-item label="站点名称">
              <el-input placeholder="请输入站点名称" v-model="formData.appName"></el-input>
            </el-form-item>
            <el-form-item label="站点地址">
              <el-input placeholder="请输入站点地址" v-model="formData.appUrl"></el-input>
            </el-form-item>
            <el-form-item label="关键字">
              <el-input placeholder="请输入关键字用逗号(',')隔开" v-model="formData.appKeyword"></el-input>
            </el-form-item>
            <el-form-item label="描述">
              <el-input type="textarea" :autosize="{minRows:3,maxRows: 8}"   placeholder="请输入描述" v-model="formData.appDescription"></el-input>
            </el-form-item>
            <el-form-item label="logo图片">
              <image-upload v-model="formData.appLogo"></image-upload>
            </el-form-item>
            <el-form-item label="模板">
              <el-select v-model="formData.appStyle" placeholder="请选择">
                <el-option
                  v-for="item in skins"
                  :key="item.name"
                  :label="item.name"
                  :value="item.name">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" size="small" @click="saveSettingInfo()">
                保存
              </el-button>
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
    </el-card>
  </section>
</template>

<script>
  export default {
    name: "siteSet",
    data() {
      return {
          formData: {
          },
          skins: []
      }
    },
    created() {
    },
    mounted() {
      this.getSettingInfo()
      this.getSkin()
    },
    computed: {
    },
    methods: {
      // 获取设置信息
      getSettingInfo() {
        let data = {appId:1}
        this.API.viewAppUsingGET(data).then(res=>{
          this.formData = res.data
        })
      },
      // 获取皮肤
      getSkin() {
        this.API.queryAppTemplateSkinUsingGET().then(res=>{
          this.skins = res.data
        })
      },
      // 保存设置信息
      saveSettingInfo() {
         let data = {app: this.formData}
         this.API.editAppUsingPOST(data).then(res=>{
            this.success('操作成功')
         })
      }
    },
    components: {
    }
  }
</script>

<style scoped>
  .el-ueditor {
    width: 90%;
    margin-left: 90px;
  }

  .el-cont {
    float: left;
    font-size: 14px;
  }

  .el-title {
    width: 94%;
    margin-left: 10px;
  }
</style>
